for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
export class Storage {
constructor() {
this.namespace = 'bgControls';
}
/**
* Get an item from local storage.
*
* @since 1.0.0
* @param {string} key Items index.
* @return {any} Value of item.
*/
getItem( key ) {
const storage = this.getStorage();
return storage[key];
* Set a namespaced item within local storage.
* @param {string} key Key to save under.
* @param {string} value Value to save.
setItem( key, value ) {
storage[key] = value;
localStorage.setItem( this.namespace, JSON.stringify( storage ) );
localStorage
/** global: localStorage */
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.
* @param {string} key Key to delete.
removeItem( key ) {
delete storage[key];
* Remove All localstorage items.
clear() {
localStorage.removeItem( this.namespace );
* Get storage, cover.
* @return {object} Get entire storage object.
getStorage() {
const storage = localStorage.getItem( this.namespace ) || '{}';
return JSON.parse( storage );
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.